# 2 练习下面网址的操作

import time
from selenium import webdriver
from selenium.webdriver.common.by import By
# 打开浏览器
driver = webdriver.Chrome()
# 进入网页
driver.get("https://ecshop.test2.shopex123.com/")

# 1. 首页搜索操作
driver.find_element(By.CSS_SELECTOR, 'input[id="keyword"]').send_keys("资生堂")
driver.find_element(By.CSS_SELECTOR, 'input[name="imageField"]').click()
# 2. 注册操作
# reg = driver.find_element(By.CLASS_NAME, "reg")
# reg.click()
# driver.find_element(By.ID, "username").send_keys("dushen")
# driver.find_element(By.ID, "email").send_keys("dushen@dushen.com")
# driver.find_element(By.ID, "password1").send_keys("123456")
# driver.find_element(By.ID, "confirm_password").send_keys("123456")
# sb = driver.find_element(By.CLASS_NAME, "signup_button")
# sb.click()
# 3. 登录操作
driver.get("https://ecshop.test2.shopex123.com/")
driver.find_element(By.CLASS_NAME, "sign").click()
driver.find_element(By.NAME, "username").send_keys("dushen")
driver.find_element(By.NAME, "password").send_keys("123456")
driver.find_element(By.CSS_SELECTOR, 'input[name="submit"]').click()
# 关闭网页
time.sleep(5)
driver.quit()
